package com.sl.au.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.sl.au.entity.InvoiceDetailInfo;
import com.sl.au.entity.PayRegist;
import com.sl.au.entity.PaymentRegist;
import com.sl.au.repository.InvoiceDetailInfoRepository;
import com.sl.au.service.InvoiceDetailInfoService;

@Service("InvoiceDetailInfoService")
@Transactional
public class InvoiceDetailInfoServiceImpl extends BaseServiceImpl implements InvoiceDetailInfoService {

	@Autowired
	InvoiceDetailInfoRepository invoiceDetailInfoRepository;
	@Override
	public InvoiceDetailInfoRepository getRepository() {
		// TODO Auto-generated method stub
		return this.invoiceDetailInfoRepository;
	}
	@Override
	public List<InvoiceDetailInfo> getInvoiceDetailInfoHistory(int start, int length, String contractId,
			String contractType, String userId, String object, String object2) {
		Page<InvoiceDetailInfo> payRegists=null;
		Pageable pageable=new PageRequest(start/length,length, Sort.Direction.DESC,"createTime");
		payRegists=invoiceDetailInfoRepository.getInvoiceDetailInfoHistory(contractId,contractType,userId,pageable);
		return payRegists.getContent();
	}
	@Override
	public Long getInvoiceDetailInfoHistoryCount(String contractId, String contractType, String userId) {
		// TODO Auto-generated method stub
		return invoiceDetailInfoRepository.getInvoiceDetailInfoHistoryCount(contractId,contractType,userId);
	}
	@Override
	public List<InvoiceDetailInfo> getInvoiceDetailInfoAllHistory(int start, int length, String contractId,
			String contractType, String object, String object2) {
		Page<InvoiceDetailInfo> payRegists=null;
		Pageable pageable=new PageRequest(start/length,length, Sort.Direction.DESC,"createTime");
		payRegists=invoiceDetailInfoRepository.getInvoiceDetailInfoAllHistory(contractId,contractType,pageable);
		return payRegists.getContent();
	}
	@Override
	public Long getInvoiceDetailInfoAllHistoryCount(String contractId, String contractType) {
		// TODO Auto-generated method stub
		return invoiceDetailInfoRepository.getInvoiceDetailInfoAllHistory(contractId,contractType);
	}

}
